<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>会员设置</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="/static/admin/public/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/static/admin/public/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/static/admin/public/css/animate.min.css" rel="stylesheet">
    <link href="/static/toastr/toastr.min.css" rel="stylesheet"></link>
    <link href="/static/admin/public/css/style.min.css?v=3.2.0" rel="stylesheet">
    <link href="/static/admin/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css?v=3.2.0" rel="stylesheet">
</head>
<body class="fixed-sidebar full-height-layout gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins" >
        <div class="ibox-title">
            <h5>会员设置</h5>
            <div class="pull-right">
                <a href="/admin/member/index" class="btn btn-link">返回</a>
            </div>
        </div>
        <div class="ibox-content">
            <form id="commentForm" class="form-horizontal m-t">
                <div class="form-group"><label class="col-sm-2 control-label">选择日期：</label>
                    <div class="col-sm-10">
                        <input readonly v-model="member_time" name="member_time" id="member_time" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-3"><button type="button" @click="setMemberGrade()" class="btn btn-primary">提交</button></div>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="/static/admin/public/js/jquery-2.1.1.min.js"></script>
<script src="/static/admin/public/js/bootstrap.min.js?v=3.4.0"></script>
<script src="/static/admin/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/admin/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/static/admin/plugins/layer/layer.min.js"></script>
<script type="text/javascript" src="/static/vue/vue.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/static/util/axios.min.js"></script>
<script type="text/javascript" src="/static/admin/api/require.js"></script>
<script type="text/javascript" src="/static/admin/api/publicAjax.js"></script>

<!-- 第三方插件 -->

<script src="/static/toastr/toastr.min.js"></script>
<script src="/static/toastr/customToastr.js"></script>

<script src="/static/admin/plugins/validate/jquery.validate.min.js"></script>
<script src="/static/admin/plugins/validate/messages_zh.min.js"></script>
<!--时间组件-->
<script src="/static/util/laydate/laydate.js"></script>
<script>
    id = '{$id}'
    var vmAddChannel = new Vue({
        el:"#commentForm",
        data:{
            member_time:'',
            member_id:id
        },
        methods:{
            setMemberGrade:function () {
                let el = this;
                if($("#commentForm").valid()){
                    let postData = {
                        'member_time':el.member_time,
                        'member_id':el.member_id
                    }
                    console.log(postData);
                    AjaxPost(postData,'/admin/member/changeMemberGrade').then((response=>{
                        console.log(response);
                        if(response.status==1){
                            $.customToastr('success',response.message)
                            setTimeout(()=>{
                               window.location.href='/admin/member/index'
                            },1000)
                        }
                    }))
                }
            },
            //getMemberInfoOneById
            getMemberInfo:function () {
                let el = this;
                    let postData = {
                        'member_id':el.member_id
                    }
                    AjaxPost(postData,'/admin/member/getMemberInfoOneById').then((response=>{
                        if(response.result.member_time){
                            this.$nextTick(function () {
                                laydate.render({
                                    elem: '#member_time', //指定元素
                                    done: function (value) {
                                        el.member_time =value
                                    },
                                    value:response.result.member_time
                                });
                            })
                        }
                        console.log(response);
                    }))
            },
        },
        mounted(){
            var el =this
            el.getMemberInfo()
            this.$nextTick(function () {
                laydate.render({
                    elem: '#member_time', //指定元素
                    done: function (value) {
                        el.member_time =value
                    }
                });
            })
        }
    })
</script>

</body>

</html>